//package com.hellowx_ssm;
//
//import org.springframework.web.WebApplicationInitializer;
//import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
//import org.springframework.web.servlet.DispatcherServlet;
//
//import javax.servlet.ServletContext;
//import javax.servlet.ServletException;
//import javax.servlet.ServletRegistration;
//
///**
// * Created by IntelliJ IDEA.
// *
// * @author MagicMushroom
// * @date 2021/6/25
// */
//public class WebInit implements WebApplicationInitializer {
//    @Override
//    public void onStartup(ServletContext servletContext) throws ServletException {
//
//        //扫描springmvc的配置文件
//        AnnotationConfigWebApplicationContext afw =
//                new AnnotationConfigWebApplicationContext();
//        afw.register(SpringMVCConfig.class,AppConfiguration.class);
//
//        //添加dispatchServlet
//        ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(afw));
//
//        //添加映射文件路径
//        dispatcher.addMapping("/");
//
//        //给springmvc添加启动时机
//        dispatcher.setLoadOnStartup(1);
//    }
//}
